package com.test.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.test.service.HelloService;

@Controller
public class HelloController {
	@Value("${hello}")
	String hello;

	@Autowired
	HelloService helloService;
	
	
	static {
		System.out.println(HelloController.class.getClassLoader().getClass().getName());
		System.out.println("=====>"+Thread.currentThread().getContextClassLoader()+"<===============");
		System.out.println("hellocontroller  init....");
	}
	
	
	@RequestMapping("/hello")
	@ResponseBody
	public String hello(String name) {
		ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
		System.out.println(contextClassLoader+" parent:"+contextClassLoader.getParent()+",,,"+hello);
//		List<People> list = new ArrayList<>();
//		People p = new People();
//		p.setAge(10);
//		p.setName("zh");
//		list.add(p);
		helloService.sayHi(name);
		return "hello:"+name;
	}
}
